package com.geeksaga.dao.ibatis.oracle;


import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import com.geeksaga.common.util.Util;
import com.geeksaga.dao.IpCountryDao;
import com.geeksaga.dao.ibatis.BaseIBatisDao;
import com.geeksaga.domain.IpCountry;

/**
 * @author newbie
 * @since 0.1
 */
@Repository
public class IpCountryDaoImpl extends BaseIBatisDao implements IpCountryDao {

    /* (non-Javadoc)
     * @see com.geeksaga.dao.IpCountryDao#findByIp(java.lang.String)
     */
    public IpCountry findByIp(String ip) throws DataAccessException {
        return (IpCountry) getSqlMapClientTemplate().queryForObject("IP_COUNTRY.findByIp", Util.ipToLong(ip));
    }
}